import request from '@/utils/request'

import { baseUrlConfig } from '@/config/config'
const basePath = baseUrlConfig.processBaseUrl

export interface PageListType {
  pageNum: number
  pageSize: number
  condition: {
    type?: string
    eventTypeId?:string[]
    eventLevel?:string
    reportCreatorName?:string
    occurDate?: string[]
    reportDate?: string[]
    status?: string
    eventTimeBegin?:string
    eventTimeEnd?:string
    handTimeBegin?:string
    handTimeEnd?:string
    process_group_id?: string
  }
  order?:{
    column?: string | undefined
    method?: string | undefined
  }[]
}

// 获取分页列表
export const getPageList: (data: any) => Promise<[]> = (data) => {
  return request({
    url: basePath + '/event/know/pageList',
    method: 'post',
    data
  })
}

// 导出
export const exportList: (data: any) => Promise<[]> = (data) => {
  return request({
    responseType: 'blob',
    url: basePath + '/event/know/export',
    method: 'post',
    data
  })
}

// 编辑
export const editKnow: (data: any) => Promise<[]> = (data) => {
  return request({
      url: basePath + '/event/know/update',
      method: 'post',
      data
  })
}
/**
 * 查看
 * @param id 
 * @returns 
 */
export const getDetail: (id: any) => Promise<[]> = (id) => {
  return request({
      url: basePath + `/event/know/get/${id}`,
      method: 'get',
  })
}

// 审核
export const review: (data: any) => Promise<[]> = (data) => {
  return request({
      url: basePath + '/event/know/rewiew',
      method: 'post',
      data
  })
}
// 获取协同事件类型顶层
export const getCooperateEventType: (data: any) => Promise<[]> = (data) => {
  return request({
      url: basePath + '/event/eventType/top',
      method: 'post',
      data
  })
}
